#ifndef _DatasetIO_dataset_io_H_
#define _DatasetIO_dataset_io_H_

#include <boost/filesystem.hpp>

#include "dataset_io_types.h"

namespace DatasetIO {

namespace fs = boost::filesystem;

enum class DatasetType {
    kUnknown = 0,
    kPanoVideo = 1,
    kPanoSeq = 2,
    kNclt = 3,
    kKitti = 4
};

class Dataset {
public:
    typedef std::shared_ptr<Dataset> Ptr;
    Dataset() {}
    virtual ~Dataset(){};

    // virtual size_t get_num_cams() const = 0;

    virtual std::vector<double> &get_image_timestamps(){};
    virtual const std::vector<AccelData::Ptr> &get_accel_data() const {};
    virtual const std::vector<GyroData::Ptr> &get_gyro_data() const {};
    virtual const std::vector<double> &get_gt_timestamps() const {};
    virtual const std::vector<PoseData::Ptr> &get_gt_pose_data() const {};
    virtual int64_t get_mocap_to_imu_offset_ns() const {};
    virtual std::vector<MonoImageData::Ptr> get_image_data(double t_ns){};
    virtual MonoImageData::Ptr get_next_mono_image_data(){};
    virtual std::vector<std::vector<Measurement::Ptr>> get_nearest_data(){};
    virtual std::vector<AccelData::Ptr> get_range_accel_data(
        const double &start_timestamp, const double &end_timestamp){};
    virtual std::vector<GyroData::Ptr> get_range_gyro_data(
        const double &start_timestamp, const double &end_timestamp){};

    DatasetType type;

    EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};

class DatasetIoInterface {
public:
    typedef std::shared_ptr<DatasetIoInterface> Ptr;
    virtual void read(const std::string &path) = 0;
    virtual void reset() = 0;
    virtual Dataset::Ptr get_data() = 0;

    virtual ~DatasetIoInterface(){};
};

class DatasetIoFactory {
public:
    static DatasetIoInterface::Ptr getDatasetIo(
        const std::string &dataset_type);
    static bool getNextMonoImage(DatasetIoInterface::Ptr dataset_interface,
                                 MonoImageData::Ptr &mono_image_data);
    static bool getNextData(
        DatasetIoInterface::Ptr dataset_interface,
        std::vector<std::vector<Measurement::Ptr>> &all_datas);
};

}  // namespace DatasetIO

#endif